/**
 * Copyright (C) 2002-2007 WUZEWEN. All rights reserved.
 * WUZEWEN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 * This software is the confidential and proprietary information of
 * WuZeven, Personal. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with WuZeven.
 */

package com.kingcore.pda;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;

import com.kingcore.pda.project.bean.ProjectBean;

/**
 * <p>	> application级别的对象getter, setter；
 * 		> systemProperty的getter,setter；
 * 		> getter对应的各种Key常量；</p>
 * @author Zeven on 2007-12-4
 * @version	1.0
 * @see		Object#equals(java.lang.Object)
 * @see		Object#hashCode()
 * @see		HashMap
 * @since	JDK5
 */

public class PdaContext implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public static final String Key_ProjectList = "projectsList";  
	public static final String Key_SystemProperty = "system_property";
	public static final String Key_SysProjectsList = "system_projectList";  // 名称最好不要使用./等特殊分割符号连接，可以使用-_等符号
	public static final String Key_OutputFilePath = "outputFilePath";	//系统项目输出路径
	public static final String Key_jstels_schema_file = "jstels-schema_file";	//xml文件位置
	
	private static Map<String,ProjectBean> projectMap = null;
	
	public static Map<String, ProjectBean> getProjectMap() {
		return projectMap;
	}

	public static void setProjectMap(Map<String, ProjectBean> projectMap) {
		PdaContext.projectMap = projectMap;
	}

	// 统统的系统参数hash表
	private static Map systemProperty = new Hashtable();
	
	public static Map getSystemProperty() {
		return systemProperty;
	}

	public static void setSystemProperty(Map systemProperty) {
		PdaContext.systemProperty = systemProperty;
	}

	public static Object getProperty(String key) {
		return systemProperty.get(key);
	}

	public static void setProperty(String key, String val) {
		systemProperty.put(key, val);
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}
	
	public static String getFolderNameByPrjCode(String prjCode){
		if (getProjectMap()==null) {
			return "";
		}
		return getProjectMap().get(prjCode).getFolderName();
	}

}
